﻿using System.Collections.Generic;
using System.Linq;
using NetworkCommsDotNet;
using DPSBase;
using System.Windows.Media;
using System.Windows;
using System.Collections.ObjectModel;
using Jive.Models;
using Jive.ViewModels;
using Jive.Helpers;
using Jive.Network;
using JmShared;

namespace Jive.User
{
    public class Client
    {
        private static Client _clientInstance;
        public static Client ClientInstance
        {
            get
            {
                if (_clientInstance == null)
                {
                    _clientInstance = new Client();
                    return _clientInstance;
                }
                else
                    return _clientInstance;

            }
        }
        public static void Clear()
        {
            _clientInstance = null;
        }
        public static readonly UserInfo GreenText = new UserInfo { Color = "#FF008000", UserName = "GreenText", FontStyle = FontStyles.Normal.ToString(), FontName = "Segoe UI" };
        public static readonly UserInfo RedText = new UserInfo { Color = "#800000", UserName = "RedText", FontStyle = FontStyles.Normal.ToString(), FontName = "Segoe UI" };
        public static readonly UserInfo GrayText = new UserInfo { Color = "#FFA9A9A9", UserName = "GrayText", FontStyle = FontStyles.Normal.ToString(), FontName = "Segoe UI" };

        public Dictionary<string, UserInfo> ConnectedClients { get; set; }//key:UserInfo.UserID
        public UserInfo CurrentUserInfo { get; set; }
        public Dictionary<string, List<ChatMessage>> PrivateMessages { get; set; }//key:UserInfo.UserName
        //public string OpenPmUserName { get; set; }
        public bool IsLoggedIn { get; set; }
        public bool IsAfk { get; set; }
        public bool IsBusy { get; set; }
        public string LastConnectedUserName { get; set; }

        private Client()
        {
            ConnectedClients = new Dictionary<string, UserInfo>();
            PrivateMessages = new Dictionary<string, List<ChatMessage>>();
        }
    }
}
